package simple_factory;

public class Customer {
    static AutomobileManufacturer car_factory = null;

    //车厂告诉客户该如何找到我们
    public AutomobileManufacturer getFactoryInstance(int condition,String carType){
        if(car_factory == null) {
            car_factory = new AutomobileManufacturer();
        }
        car_factory.getDealer(condition).product(carType);
        return car_factory;
    }

    //客户找到了车厂说我要买车
    public void buyCar(int condition,String carType){
        getFactoryInstance(condition,carType);
    }

    //模拟真正客户来了，要买一辆奥迪A8，客户该怎么做？只需像厂家提出自己的需求就好
    public static void main(String[] args) {
        Customer customer = new Customer();
        customer.buyCar(1,"奥迪A8");
    }
}
